var genderArr = [{value:true,text:'男'},{value:false,text:'女'}];
var genderObj = {value:'true:男;false:女'};

function custom_func4StudentRemark(cellVal,cellLabel){
	if(cellVal && cellVal.length>0){
		return [true,"",""];
	}
	else{
		return [false,cellLabel+","+$.jgrid.edit.msg.required,""];
	}
}

function setQueryInfo4Student(){
	return {
		entityAlias : "student",
		whereCondition : "student.clazz.clazzId ='"+$("#editClazzId").val()+"'"
	};
}
function setQueryInfo4StudentSubject(){
	return {
		entityAlias : "studentSubject",
		whereCondition : "studentSubject.student.studentId ='"+$('#tableStudent').jqGrid('getCurrentSelectRowId')+"'"
	};
}

function afterSelectRow4Student(rowid, stat){
	var saveBtnState = $("#saveBtnClazz").attr("disabled");
	if(!$.StringUtils.isEmpty(saveBtnState) && (saveBtnState===true || saveBtnState==="disabled" || saveBtnState=="disabled")){
		$("#saveBtnClazz").attr("disabled",false);
	}
	$('#tableStudentSubject').jqGrid("reloadGrid");
}

$(window).ready(function(){
	//点击选项卡 触发查询
	$('#aTabItem2').one('click',function(){
		//alert('只触发一次查询');
		$('#tableStudent').jqGrid("reloadGrid");
	});
});

function afterSelectRow4Student2(rowData){
	//联想控件的单元格对自己赋值必须用这种方式
	$(this).val(rowData.address);
	//对其它单元格赋值
	var rowId = $('#tableStudent').jqGrid('getCurrentSelectRowId');
	$("#tableStudent").jqGrid('setCell', rowId, 'telphone', rowData.telphone,false,false,true);
	$("#tableStudent").jqGrid('setCell', rowId, 'phone', rowData.phone,false,false,true);
}
function afterEditCellFunc4Student(rowId,colName,colValue,rowIndex,colIndex){
	if (colName == 'birthday') {
		$("#" + rowIndex + "_birthday", "#tableStudent").bind("focus click keyup",function(){
			WdatePicker({dateFmt:'yyyy-MM-dd'});
		});
		$("#" + rowIndex + "_birthday", "#tableStudent").trigger("focus");
	}
	if (colName == 'address') {
		//给单元格的autoSelectConfig 必须以继承方式配置$.extend({},config)
		$("#" + rowIndex + "_address", "#tableStudent").autoSelect($.extend({},colAddressAutoSelectConfig));
	}
}

function afterSelectRow4Subject(rowData){
	//联想控件的单元格对自己赋值必须用这种方式
	$(this).val(rowData.subjectCode);
	//对其它单元格赋值
	var rowId = $('#tableStudentSubject').jqGrid('getCurrentSelectRowId');
	$("#tableStudentSubject").jqGrid('setCell', rowId, 'subjectName', rowData.subjectName,false,false,true);
}
function afterEditCellFunc4StudentSubject(rowId,colName,colValue,rowIndex,colIndex){
	if (colName == 'subjectCode') {
		//给单元格的autoSelectConfig 必须以继承方式配置$.extend({},config)
		$("#" + rowIndex + "_subjectCode", "#tableStudentSubject").autoSelect($.extend({},colSubjectCodeAutoSelectConfig));
	}
}